<template>
	<view>
		<!-- 分享弹窗 -->
		<u-action-sheet title="分享到" :show="wechatPopupShow" :safeAreaInsetBottom="true" round="15" :closeOnClickOverlay="true"
			@close="shareClose">
			<view class="share flex-no-horizontal">
				<view @click="wechatShare('WXSceneSession',record)">
					<u--image src="../../static/img/weichat-color.png" width="35" height="35"></u--image>
					<view class="f-xs m-t-5">朋友</view>
				</view>
				<view @click="wechatShare('WXSceneTimeline',record)">
					<u--image src="../../static/img/weichat-moment-color.png" width="35" height="35"></u--image>
					<view class="f-xs m-t-5">朋友圈</view>
				</view>
			</view>
		</u-action-sheet>
		
	</view>
</template>

<script>
	export default {
		props: {
			wechatPopupShow: { 			//分享显示控制
				type: Boolean,
				default () {
					return false;
				}
			},
			record:{
				type:Object,
				default (){
					return {}
				}
			}
		},
		data() {
			return {
				
			};
		},
		methods: {
			
			//分享微信
			wechatShare(type,item) {
				let parameter = {}
				item.fileName.length === 0 ? parameter = {type:1,summary:item.text} : parameter = {type:0,href:'http://seed.relaverse.cn/#/',title:'轻松小镇',summary:item.text,imageUrl: item.fileName[0]}
				uni.share({
					provider: "weixin",
					scene: type,
					...parameter,
					success: (res) => {
						console.log(res)
					},
					fail: (err) => {
						console.log(err)
						uni.showToast({
							title:'分享失败~',
							icon:'none'
						})
					},
					complete: (com) => {
						this.$emit('wechatPopupFun',false)
					}
				})
			},
			
			//弹窗关闭
			shareClose(){
				this.$emit('wechatPopupFun',false)
			},
			
		},
	};
	
</script>

<style lang="scss" scoped>
	.share {
		justify-content: space-around;
		padding: 0 40rpx 120rpx;
	}
</style>
